<!doctype html>
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta name="layout" content="common">
<title>Dashboard</title>

<style type="text/css">
table.display tr.odd {
	background-color: #ddffdd;
}

table.display tr.even {
	background-color: #eeffee;
}
</style>
</head>
<body>
	<h2>Dashboard</h2>
	<hr />

	<h3>Manage Deals</h3>
	<table cellpadding="0" cellspacing="0" border="0" class="display" width="95%">
		<thead>
			<tr>
				<td width="5%"><b>SN</b></td>
				<td><b>Title</b></td>
				<td width="15%"><b>Locations</b></td>
				<td width="15%"><b>Start Date</b></td>
				<td width="15%"><b>End Date</b></td>
			</tr>
		</thead>
		<tbody>
			<g:each in="${dealInstanceList}" var="deal" status="dealStat">
				<tr <g:if test="${dealStat % 2 == 0 }">class="odd"</g:if><g:else>class="even"</g:else>>
					<td>${dealStat + 1}</td>
					<td><g:link controller="deal" action="edit" id="${deal.id}" params="[prevAction: 'dashboard']">${fieldValue(bean: deal, field: "title")}</g:link></td>
					<td>${fieldValue(bean: deal, field: "country.name")}</td>
					<td><g:formatDate date="${deal.startDate}"  format="dd/MM/yyyy" /></td>
					<td><g:formatDate date="${deal.endDate}"  format="dd/MM/yyyy" /></td>
				</tr>
			</g:each>
		</tbody>
		<tr>
			<td colspan="6" align="right"><g:link action="list" controller="deal" params="[search: 'Search']">[View More]</g:link></td>
		</tr>
	</table>
	
	<h3>Manage Members</h3>
	<table cellpadding="0" cellspacing="0" border="0" class="display" width="95%">
		<thead>
			<tr>
				<td width="5%"><b>SN</b></td>
				<td width="15%"><b>Login ID</b></td> 
				<td><b>Name</b></td>
				<td width="15%"><b>NRIC</b></td>
				<td width="10%"><b>Status</b></td>
				<td width="20%"><b>Last Login Date</b></td>
			</tr>
		</thead>
		<tbody>
			<g:each in="${userInstanceList}" var="usr" status="usrStat">
				<tr <g:if test="${usrStat % 2 == 0 }">class="odd"</g:if><g:else>class="even"</g:else>>
					<td>${usrStat + 1}</td>
					<td><g:link controller="user" action="update" id="${usr.id}" params="[prevAction: 'dashboard']">${fieldValue(bean: usr, field: "username")}</g:link></td>
					<td>${fieldValue(bean: usr, field: "name")}</td>
					<td>${fieldValue(bean: usr, field: "nric")}</td>
					<td>${fieldValue(bean: usr, field: "status")}</td>
					<td><g:formatDate date="${usr.loginDate}"  format="dd/MM/yyyy HH:mm:ss" /></td>
				</tr>
			</g:each>
		</tbody>
		<tr>
			<td colspan="6" align="right"><g:link action="search" controller="user" params="[search: 'Search']">[View More]</g:link></td>
		</tr>
	</table>
	
	<h3>Manage Merchants</h3>
	<table cellpadding="0" cellspacing="0" border="0" class="display" width="95%">
		<thead>
			<tr>
				<td width="5%"><b>SN</b></td>
				<td><b>Name</b></td>
				<td width="25%"><b>Country</b></td>
				<td width="20%"><b>Status</b></td>
			</tr>
		</thead>
		<tbody>
			<g:each in="${merchantInstanceList}" var="merchant" status="merchantStat">
				<tr <g:if test="${merchantStat % 2 == 0 }">class="odd"</g:if><g:else>class="even"</g:else>>
					<td>${merchantStat + 1}</td>
					<td><g:link controller="merchant" action="update" id="${merchant.id}" params="[prevAction: 'dashboard']">${fieldValue(bean: merchant, field: "name")}</g:link></td>
					<td>${fieldValue(bean: merchant, field: "country.name")}</td>
					<td>${fieldValue(bean: merchant, field: "status")}</td>
				</tr>
			</g:each>
		</tbody>
		<tr>
			<td colspan="6" align="right"><g:link action="search" controller="merchant" params="[search: 'Search']">[View More]</g:link></td>
		</tr>
	</table>
	
	<h3>Manage Vouchers</h3>
	<table cellpadding="0" cellspacing="0" border="0" class="display" width="95%">
		<thead>
			<tr>
				<td width="5%"><b>SN</b></td>
				<td><b>Title</b></td> 
				<td width="15%"><b>Total Quantity</b></td>
				<td width="15%"><b>Start Date</b></td>
				<td width="15%"><b>End Date</b></td>
			</tr>
		</thead>
		<tbody>
			<g:each in="${voucherInstanceList}" var="voucher" status="voucherStat">
				<tr <g:if test="${voucherStat % 2 == 0 }">class="odd"</g:if><g:else>class="even"</g:else>>
					<td>${voucherStat + 1}</td>
					<td><g:link controller="voucher" action="edit" id="${voucher.id}" params="[prevAction: 'dashboard']">${fieldValue(bean: voucher, field: "title")}</g:link></td>
					<td>${fieldValue(bean: voucher, field: "totalQuantity")}</td>
					<td><g:formatDate date="${voucher.startDate}"  format="dd/MM/yyyy" /></td>
					<td><g:formatDate date="${voucher.endDate}"  format="dd/MM/yyyy" /></td>
				</tr>
			</g:each>
		</tbody>
		<tr>
			<td colspan="6" align="right"><g:link action="list" controller="voucher" params="[search: 'Search']">[View More]</g:link></td>
		</tr>
	</table>
	<br/>
</body>
</html>